if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_UpdateUser]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_UpdateUser]
GO
CREATE PROC sp_UpdateUser
	@id						int,
	@email					varchar(200),
	@address				varchar(200),
	@firstname				nvarchar(50),
	@lastname				nvarchar(100),
	@phone					varchar(20),
	@birthday				varchar(20),
	@accountType			nvarchar(200)

AS
BEGIN
	DECLARE @accType int
	SELECT ID=@accType FROM AccoutType WHERE [NAME] = @accountType

	Update Account
		SET AccountType = @accType WHERE ID = @id

	UPDATE AccountInformation
		SET
			FirstName = @firstname,
			LastName = @lastname,
			Email = @email,
			Address = @address,
			Phone = @phone,
			Birthday = @birthday
		WHERE
			AccountID = @id
END
